public class Test {
    public static void main1(String[] args) {
        String str = "hello";
        str += "abc";
        System.out.println(str);
    }

    public static void main2(String[] args) {
        String str = "hello";
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(str);
        stringBuilder.append("abc");
//        这里调用toString方法的作用是，在拼接完成之后，有一个新的String对象
        str = stringBuilder.toString();
        System.out.println(str);
    }

    public static void main3(String[] args) {
        StringBuilder stringBuilder = new StringBuilder("abc");
        System.out.println(stringBuilder);
        stringBuilder.append("123").append(10);
        stringBuilder.append(19.0);
        System.out.println(stringBuilder);
    }

    public static void main4(String[] args) {
        StringBuilder stringBuilder = new StringBuilder("abc");
        String ret = stringBuilder.toString();
    }


}

